package com.example.knowman.ObService.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.knowman.ObService.OBknowLabelDetailService;
import com.example.knowman.ObService.OBlabelCategoryService;
import com.example.knowman.entity.knowArchFiles;
import com.example.knowman.entity.knowLabelDetail;
import com.example.knowman.entity.labelCategory;
import com.example.knowman.mapper.KnowLabelDetailMapper;
import com.example.knowman.mapper.LabelCategoryMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ObKnowLabelDetailServiceImpl extends ServiceImpl<KnowLabelDetailMapper, knowLabelDetail> implements OBknowLabelDetailService {


    @Override
    public Integer backNumBylabelCateId(Integer labelCateId) {
        return this.lambdaQuery().select().eq(knowLabelDetail::getLabelCateId,labelCateId).count();
    }

    @Override
    public void deleteByknowLblId(Integer knowLblId) {
        QueryWrapper<knowLabelDetail> wrapper = new QueryWrapper<>();
        wrapper.eq("\"knowLblId\"",knowLblId);
        try{
            this.remove(wrapper);
        }catch (Exception e){

        }
    }

    @Override
    public Integer backByknowLblId(Integer knowLblId) {
        return this.lambdaQuery().select().eq(knowLabelDetail::getKnowLblId,knowLblId).count();
    }

    @Override
    public List<knowLabelDetail> Dabiaos(Integer knowLblId) {
        return this.lambdaQuery().select().eq(knowLabelDetail::getKnowLblId,knowLblId).list();
    }
}
